package com.itheima.test;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class Demo2 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String s = "中国";
        byte[] bytes = s.getBytes();
        byte[] gbks = s.getBytes("gbk");
        //Arrays.toString将其转换为字符串数组
        System.out.println(Arrays.toString(bytes));//[-28, -72, -83, -27, -101, -67]
        System.out.println(Arrays.toString(gbks));//[-42, -48, -71, -6]
    }
}
